 #-*- coding: utf-8 -*-

from weblog.models import  Author,Entry,About,Category, Tag
from django.contrib import admin
from django.conf import settings


class Entryadmin(admin.ModelAdmin):
    list_display=('title','authors','pub_date','category')
    list_filter = ['pub_date']
    search_fields = ['title']
    date_hierarchy = 'pub_date'
    fieldsets=[
            (None, {'fields':['title']}),
            (None, {'fields':['authors']}),
            (None, {'fields':['body_text']}),
            (None, {'fields':['category']}),
            ('标签', {'fields':['tag'],'classes':['collapse']}),
            ]
    class Media:
        js = ('/site_media/js/tiny_mce/tiny_mce.js',
             '/site_media/js/textareas.js',)
#   inlines=[ChoiceInLine]
#   list_display=('name','pub_date')
#   search_fields = ['question']

class Aboutadmin(admin.ModelAdmin):
    class Media:
        js = ('/site_media/js/tiny_mce/tiny_mce.js',
             '/site_media/js/textareas.js',)


class Categoryadmin(admin.ModelAdmin):
    list_display=('name','entry_set')


admin.site.register(Entry,Entryadmin)
admin.site.register(About,Aboutadmin)
#admin.site.register(Blog,BlogAdmin)
admin.site.register(Author)
admin.site.register(Category,Categoryadmin)
admin.site.register(Tag)
